package scm.server;

import java.util.Collection;
import java.util.Hashtable;


public class Lista {
	private Hashtable<String, Object> clientList = null;
	private int indexValue;
	
	public Lista(){
		clientList = new Hashtable<String, Object>();
		indexValue = 0;
	}
	
	public boolean Contiene(String clave){
		return clientList.containsKey(clave);
	}
	
	public void addicionar(String clave, Object client){
		clientList.put(clave, client);
	}
	
	public Object devolver(String destinatario){
		 return clientList.get(destinatario);		
	}
	
	public Object devolverSiguiente(){
		Collection<Object> valores = clientList.values(); 
		if (indexValue < valores.size()){
			Object[] vector = valores.toArray();
			Object valor = vector[indexValue];
			indexValue++;
			return valor;
		}
		return null;		
	}
	
	public int cantidad(){
		return clientList.size();
	}
}
